package General;

import java.io.Serializable;
import java.util.Calendar;

import org.bingmaps.app.MainActivity;
import org.bingmaps.app.NowTracking;
import org.bingmaps.app.R;
import org.bingmaps.app.WhatToTrack;

import android.annotation.TargetApi;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.util.Log;
import locationServices.GetGpsCoordinate;
import locationServices.MyLocationListener;

public class GlobalValueClass implements Serializable{

	private static GetGpsCoordinate COORDINATES = null;
	private static LocationManager mlocManager = null;
	private static LocationListener mlocListener = null;
	private static int Frequency; 
	private static Context context;
	private static StringBuilder FileName;
	private static String TrackingType = new String();
	
	public  GlobalValueClass(LocationManager mlocManage, LocationListener mlocListene )
	{
		mlocManager = mlocManage;
        mlocListener = mlocListene;
       
        
        Calendar calendar = Calendar.getInstance();
        FileName = new StringBuilder();  
       	FileName.append(calendar.get(Calendar.YEAR)+"_"
   			 +(int)(calendar.get(Calendar.MONTH)+1)+"_"
   			 +calendar.get(Calendar.DAY_OF_MONTH)+"_"
   			 +calendar.get(Calendar.HOUR_OF_DAY)+"_"
   			 +calendar.get(Calendar.MINUTE)+"_"
   			 +calendar.get(Calendar.SECOND));
       	
       	String s = new String();
       	s = FileName.toString();
       	int i=0;
       	i=1;
       	
}
	
	@TargetApi(Build.VERSION_CODES.CUPCAKE)
	static void  CreatesStatusNotification()
	{

		NotificationCompat.Builder mBuilder =
		        new NotificationCompat.Builder(context)
		        .setSmallIcon(R.drawable.ic_launcher)  //ICON
		        .setContentTitle("Tracking Me")
		        .setContentText("Track in Progress!");
		// Creates an explicit intent for an Activity in your app
		Intent resultIntent = new Intent(context, MainActivity.class);
		// The stack builder object will contain an artificial back stack for the
		// started Activity.
		// This ensures that navigating backward from the Activity leads out of
		// your application to the Home screen.
		TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
		// Adds the back stack for the Intent (but not the Intent itself)
		stackBuilder.addParentStack(MainActivity.class);
		// Adds the Intent that starts the Activity to the top of the stack
		stackBuilder.addNextIntent(resultIntent);
		PendingIntent resultPendingIntent =
		        stackBuilder.getPendingIntent(
		            0,
		            PendingIntent.FLAG_UPDATE_CURRENT
		        );
		mBuilder.setContentIntent(resultPendingIntent);
		NotificationManager mNotificationManager =
		    (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
		// mId allows you to update the notification later on.
		mNotificationManager.notify(100, mBuilder.build());
	}

	
	public static void Inititalize(int Frequenc)
	{

		Frequency = Frequenc;
       	CreatesStatusNotification();  	
        COORDINATES = new GetGpsCoordinate();
	}

	public static GetGpsCoordinate Get_GetGpsCoordinate(){return COORDINATES;}
	public static void ChangeContext(Context c){context = c;} 
	public static int GET_Frequency(){return Frequency;};
	public static StringBuilder GET_FileName(){return FileName;}
	public static LocationManager GET_mlocManager(){return mlocManager;}
	public static LocationListener GET_mlocListener(){return mlocListener;}
	public static Context GET_Context(){return context;} 
	public static String GetTrackingType(){return TrackingType;}
	public static void SetTrackingType(String trackT){ TrackingType = trackT;}
	


}
